home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_1631.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  855 b   |  3 lines

  1. Short ans: Please read previous question first; this is a corollary.
  2.  
  3. Long ans: In C++, member fns have an implicit parameter which points to the object (the 'this' ptr inside the member fn).  Normal C fns can be thought of as having a different calling convention from member fns, so the types of their ptrs (ptr-to-member-fn vs ptr-to-fn) are different and incompatible.  C++ introduces a new type of ptr, called a ptr-to-member, which can only be invoked by providing an object (see ARM 5.5).  Do NOT attempt to 'cast' a ptr-to-mem-fn into a ptr-to-fn; the result is undefined and probably disastrous; a ptr-to- member-fn is NOT required to contain the machine addr of the appropriate fn (see ARM, 8.1.2c, p.158).  As was said in the last example, if you want a regular C fn ptr, use either a top-level (non-class) fn, or a 'static' (class) member fn.